package com.ruoyi.web.controller.tech;

import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.Tech;
import com.ruoyi.system.service.ITechService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Anonymous  //此注解是不加权限直接可以调用该类的所有接口
@RestController
@RequestMapping("/company/tech")
public class TechController extends BaseController {

    @Autowired
    private ITechService techService;

    //列表
    //http://127.0.0.1:9070/company/tech/list
    @GetMapping("/list")
    public TableDataInfo list(Tech tech) {
        startPage();
        List<Tech> list = techService.selectByPage(tech);
        return getDataTable(list);
    }

    //修改人员状态
    //http://127.0.0.1:9070/company/tech/changeStatus
    @PutMapping("/changeStatus")
    public AjaxResult updateStatus(@Validated @RequestBody Tech tech) {
        int i = techService.updateStatus(tech);
        return toAjax(i);
    }
}
